package com.zhou.org.dao;

import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.zhou.org.common.EnumConstant;
import com.zhou.org.common.OrgUtil;
import lombok.Data;

import java.io.Serializable;
import java.util.Objects;

/**
 * <p>
 * 
 * </p>
 *
 * @author lang.zhou
 * @since 2022-08-23
 */
@TableName("sys_org")
@Data
public class Org implements Serializable {

    private static final long serialVersionUID = 1L;

    @TableId(value = "orgid", type = IdType.AUTO)
    private Integer orgId;

    private String description;

    private String orgName;
    @TableField(exist = false)
    private String iconClass;

    /**
     * 1-用户；2-部门；3-角色
     */
    private Integer orgType;
    @TableField("user_id")
    private Integer userId;

    public void setOrgType(Integer orgType) {
        this.orgType = orgType;
        this.iconClass = OrgUtil.getIcon(orgType);
    }
}
